#ifndef _INI_H
#define _INI_H

#include <xlibrary.h>

// common headers
#include "common.h"		// global

// local headers
#include "library.h"	// internal

typedef enum {
	L_EMPTY,
	L_COMMENT,
	L_SECTION,
	L_ASSIGNMENT,
	L_ERROR
} eLSTATUS;	// line status

#define isspace(c) ((c)==' ' || (c)=='\t' || (c)=='\n' || (c)=='\r')
#define iscomment(c) ((c)=='#' || (c)==';')

void *	open		(FILE *fd, u8 idx_ext);

int		get_first	(void *confd, char **section, char **param, char **value);
int		get_next	(void *confd, char **section, char **param, char **value);

int		get_string	(void *confd, char *section, char *param, char **value);
int		get_bool	(void *confd, char *section, char *param, bool *value);
int		get_integer	(void *confd, char *section, char *param, s32 *value);
int		get_float	(void *confd, char *section, char *param, float *value);

int		set_string	(void *confd, char *section, char *param, char *value);
int		set_bool	(void *confd, char *section, char *param, bool value);
int		set_integer	(void *confd, char *section, char *param, s32 value);
int		set_float	(void *confd, char *section, char *param, float value);

int		unset		(void *confd, char *section, char *param);

int		save		(void *confd, FILE *fd);
void	close		(void *confd);

#endif

